package io.gitee.macxiang.entity;

/** 返回结果是数字的查询构造器 */
public class ExecNumber {
  final public String sql;

  @FunctionalInterface
  public interface SqlExecCallback {
    int process(String input);
  }

  final private SqlExecCallback callback;

  public ExecNumber(String sql, SqlExecCallback callback) {
    this.sql = sql;
    this.callback = callback;
  }

  public int exec() {
    if (callback != null) {
      return callback.process(sql);
    }
    return 0;
  }
}
